<template>
	<div>
		<p>姓名：{{character.name}}</p>
		<p>年龄：{{character.age}}</p>
		<p>魔力：{{character.mana}}</p>
		age的值：{{age}}
		mana的值：{{mana}}
		name的值：{{name}}
	</div>
</template>

<script setup>
	//toRefs()函数用于将响应式对象中的所有属性转换为响应式数据
	import {ref,reactive,toRef,toRefs} from 'vue'
	const character=reactive({   //响应式对象
		name:'银时',
		age:18,
		mana:2000
	})
	
	let {name,age,mana} =toRefs(character)
	
	setTimeout(()=>{
		name.value='太乙真人'
		mana.value=3000
		age.value=28
	},2000)
</script>

<style>
</style>